package org.nepu.srr.domain.equipmentdata.converter.drillingdevice;

import cn.hutool.json.JSONUtil;
import org.nepu.srr.domain.equipmentdata.vo.drillingdevice.EmergencyDeploymentTable;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class EmergencyDeploymentTableConverter implements AttributeConverter<EmergencyDeploymentTable, String> {
    @Override
    public String convertToDatabaseColumn(EmergencyDeploymentTable emergencyDeploymentTable) {
        return JSONUtil.toJsonStr(emergencyDeploymentTable);
    }

    @Override
    public EmergencyDeploymentTable convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, EmergencyDeploymentTable.class);
    }
}
